#pragma once

#include "DM/Core/Base.h"
#include "DM/Core/Window.h"
#include "DM/Events/ApplicationEvent.h"

#include "DM/Core/Layer.h"
#include "DM/Core/LayerStack.h"
#include "DM/ImGui/ImGuiLayer.h"

namespace DM {

	class DM_API Application
	{

	public:
		Application();

		virtual ~Application() = default;

		void Run();
		void OnEvent(Event& e);

		void PushLayer(Layer* layer);
		void PushOverlay(Layer* layer);

		inline static Application& Get() { return *s_Instance; }
		inline Window& GetWindow() { return *m_Window; }
	private:
		bool m_Minimized = false;
		bool OnWindowClose(WindowCloseEvent& e);
		bool OnWindowResize(WindowResizeEvent& e);
		std::unique_ptr<Window> m_Window;
		bool m_Running = true;
		LayerStack m_LayerStack;
		ImGuiLayer *m_ImGuiLayer;
		static Application* s_Instance;

		float m_LastFrameTime = 0.0f;
	};

	// define by client
	Application* CreateApplication();

}
